#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 迭代器和生成器占内存情况【win运行报错】


import os
import psutil

def show_memory_info(msg):
    pid = os.getpid()
    p = psutil.Process(pid)
    info = p.memory_full_info()
    memory = info.uss / 1024. / 1024
    print('{} memory used: {} MB'.format(msg, memory))

def test_iterrator()
    show_memory_info('initing iterrator')
    lst_1 = [i for i in range(1000000)]
    show_memory_info('after iterator initiated')
    print(sum(lst_1))
    show_memory_info('after sum called')



if __name__ == '__main__':
    show_memory_info('ss')
